package com.ruoyi.equipment.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.equipment.domain.LgEquipmentError;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LgEquipmentErrorMapper extends BaseMapper<LgEquipmentError> {
    @Select("SELECT \n" +
            "    equipment_type,\n" +
            "    SUM(alarm_count) AS alarm_count\n" +
            "FROM\n" +
            "    lg_equipment_error\n" +
            "GROUP BY\n" +
            "    equipment_type\n" +
            "ORDER BY\n" +
            "    MAX(create_time) DESC;")
    public List<LgEquipmentError> selectLgEquipmentErrorCountList();


    @Select("select * from lg_equipment_error where device_number = #{deviceNumber}")
    public LgEquipmentError selectLgEquipmentErrorByDeviceNumber(Integer deviceNumber);
}
